#ifndef	__cuda_tracer_h__
#define	__cuda_tracer_h__

#include "inccommon.h"

namespace rtMath
{
class vec4;
class Ray;
};

class Scene;
class Image;
class SceneCamera;

class CudaTracer
{
public:
	CudaTracer();
	~CudaTracer();

	void			SetMaximumTraceDepth(int maxTraceDepth);
	bool			PrepareSceneData(const Scene& scene, Image& screen);
	void			Render(Image& screen) const;
	void			ResizeScreen(int width, int height);
	void			UpdateCamera(SceneCamera* camera);

private:
	int				GrabSpheresFromScene(const Scene& scene);
	int				GrabBoxesFromScene(const Scene& scene);
	int				GrabPlanesFromScene(const Scene& scene);
	int				GrabMaterialsFromScene(const Scene& scene);
	int				GrabTexturesFromScene(const Scene& scene);
	int				GrabLightsFromScene(const Scene& scene);

private:
	int				m_MaximumTraceDepth;
	bool			m_DataPrepared;

	void*			m_DeviceSpheresPtr;
	int				m_SpheresCount;
	void*			m_DeviceBoxesPtr;
	int				m_BoxesCount;
	void*			m_DevicePlanesPtr;
	int				m_PlanesCount;
	void*			m_DeviceMaterialsPtr;
	void*			m_DeviceLightsPtr;
	int				m_LightsCount;
	void*			m_DeviceCameraPtr;
	void*			m_DeviceImagePtr;
	int				m_ImageWidth;
	int				m_ImageHeight;
	int				m_TexturesCount;
};


#endif	// __cuda_tracer_h__
